<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2021/4/29
  Time: 2:39 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>
<body>
    <form id="register_form">
        <input type="text" name="username" id="username"><span class="c1"></span><br>
        <input type="text" name="password" id="password"><span class="c1"></span><br>
        <input type="button" id="register_btn" value="注册">
    </form>
    <script src="${path}/plugins/jquery/jquery.min.js"></script>
    <script>
        $(function(){
            $("#register_btn").click(function(){
                $(".c1").html("");

                let value = $("#register_form").serialize();
                $.post('${path}/user/reg',value,function(result){
                    if(result.code=="500"){
                        let arr = result.data;
                        for(let k in arr){
                            //console.log(k+"="+arr[k])
                            let username_input = $("#"+k).next().html("<font color='red'>"+arr[k]+"</font>")
                           // console.log(username_input)

                        }
                    }else{

                    }
                });
            });
        })
    </script>
</body>
</html>
